HAL DCACHE functions I/O operation migration

This section provides information about the HAL DCACHE function migration.

HAL DCACHE Enable

HAL1

HAL2

In HAL1, the HAL_DCACHE_Enable function will only activate the dcache, if needed to intercapte the eviction error interrupt the macro __HAL_DCACHE_ENABLE_IT() must be used.

In HAL2, the HAL_DCACHE_start function can be used to activate the dcache and enable the interruption at the same time.

HAL_DCACHE_Enable(DCACHE_HandleTypeDef *hdcache)
HAL_DCACHE_Start(hal_dcache_handle_t *hdcache, uint32_t interrupts)

Related use case: Use case: DCACHE maintenance operations in interrupt mode


HAL DCACHE disable

HAL1

HAL2

HAL_DCACHE_Disable(DCACHE_HandleTypeDef *hdcache)
HAL_DCACHE_Stop(hal_dcache_handle_t *hdcache)

HAL DCACHE is enabled

HAL1

HAL2

HAL_DCACHE_IsEnabled(const DCACHE_HandleTypeDef *hdcache)

Removed in HAL2, use LL function instead:

__STATIC_INLINE uint32_t LL_DCACHE_IsEnabled(const DCACHE_TypeDef *dcachex)


HAL DCACHE set read burst type

HAL1

HAL2

HAL_DCACHE_SetReadBurstType(DCACHE_HandleTypeDef *hdcache,
                            uint32_t ReadBurstType)
HAL_DCACHE_SetReadBurstType(hal_dcache_handle_t *hdcache,
                            hal_dcache_read_burst_t read_burst_type)

HAL DCACHE invalidate

HAL1

HAL2

HAL_DCACHE_Invalidate(DCACHE_HandleTypeDef *hdcache)
HAL_DCACHE_Invalidate(hal_dcache_handle_t *hdcache)

HAL DCACHE invalidate by address

HAL1

HAL2

Function prototype

HAL_DCACHE_InvalidateByAddr(DCACHE_HandleTypeDef *hdcache,
                            const uint32_t *const pAddr,
                            uint32_t dSize)
HAL_DCACHE_InvalidateByAddr(hal_dcache_handle_t *hdcache,
                            uint32_t addr,
                            uint32_t size_byte)

Example usage

DCACHE_HandleTypeDef hdcache1;
uint32_t *address_ptr = (uint32_t *)0x20001000;
uint32_t size = 128;

HAL_DCACHE_InvalidateByAddr(&hdcache1, address_ptr, size);
hal_dcache_handle_t hdcache1;
uint32_t address = 0x20001000;
uint32_t size = 128;

HAL_DCACHE_InvalidateByAddr(&hdcache1, address, size);

Related concept: Other HAL DCACHE changes


HAL DCACHE clean by address

HAL1

HAL2

Function prototype

HAL_DCACHE_CleanByAddr(DCACHE_HandleTypeDef *hdcache,
                       const uint32_t *const pAddr,
                       uint32_t dSize)
HAL_DCACHE_CleanByAddr(hal_dcache_handle_t *hdcache,
                       uint32_t addr,
                       uint32_t size_byte)

Example usage

DCACHE_HandleTypeDef hdcache1;
uint32_t *address_ptr = (uint32_t *)0x20001000;
uint32_t size = 128;

HAL_DCACHE_CleanByAddr(&hdcache1, address_ptr, size);
hal_dcache_handle_t hdcache1;
uint32_t address = 0x20001000;
uint32_t size = 128;

HAL_DCACHE_CleanByAddr(&hdcache1, address, size);

Related concept: Other HAL DCACHE changes


HAL DCACHE clean invalidate by address

HAL1

HAL2

Function prototype

HAL_DCACHE_CleanInvalidByAddr(DCACHE_HandleTypeDef *hdcache,
                              const uint32_t *const pAddr,
                              uint32_t dSize)
HAL_DCACHE_CleanInvalidByAddr(hal_dcache_handle_t *hdcache,
                              uint32_t addr,
                              uint32_t size_byte)

Example usage

DCACHE_HandleTypeDef hdcache1;
uint32_t *address_ptr = (uint32_t *)0x20001000;
uint32_t size = 128;

HAL_DCACHE_CleanInvalidByAddr(&hdcache1, address_ptr, size);
hal_dcache_handle_t hdcache1;
uint32_t address = 0x20001000;
uint32_t size = 128;

HAL_DCACHE_CleanInvalidByAddr(&hdcache1, address, size);

Related concept: Other HAL DCACHE changes


HAL DCACHE invalidate IT

HAL1

HAL2

HAL_DCACHE_Invalidate_IT(DCACHE_HandleTypeDef *hdcache)
HAL_DCACHE_Invalidate_IT(hal_dcache_handle_t *hdcache)

HAL DCACHE invalidate by address IT

HAL1

HAL2

Function prototype

HAL_DCACHE_InvalidateByAddr_IT(DCACHE_HandleTypeDef *hdcache,
                               const uint32_t *const pAddr,
                               uint32_t dSize)
HAL_DCACHE_InvalidateByAddr_IT(hal_dcache_handle_t *hdcache,
                               uint32_t addr,
                               uint32_t size_byte)

Example usage

DCACHE_HandleTypeDef hdcache1;
uint32_t *address_ptr = (uint32_t *)0x20001000;
uint32_t size = 128;

HAL_DCACHE_InvalidateByAddr_IT(&hdcache1, address_ptr, size);
hal_dcache_handle_t hdcache1;
uint32_t address = 0x20001000;
uint32_t size = 128;

HAL_DCACHE_InvalidateByAddr_IT(&hdcache1, address, size);

Related concept: Other HAL DCACHE changes


HAL DCACHE clean by address IT

HAL1

HAL2

Function prototype

HAL_DCACHE_CleanByAddr_IT(DCACHE_HandleTypeDef *hdcache,
                          const uint32_t *const pAddr,
                          uint32_t dSize)
HAL_DCACHE_CleanByAddr_IT(hal_dcache_handle_t *hdcache,
                          uint32_t addr,
                          uint32_t size_byte)

Example usage

DCACHE_HandleTypeDef hdcache1;
uint32_t *address_ptr = (uint32_t *)0x20001000;
uint32_t size = 128;

HAL_DCACHE_CleanByAddr_IT(&hdcache1, address_ptr, size);
hal_dcache_handle_t hdcache1;
uint32_t address = 0x20001000;
uint32_t size = 128;

HAL_DCACHE_CleanByAddr_IT(&hdcache1, address, size);

Related concept: Other HAL DCACHE changes


HAL DCACHE clean invalidate by address IT

HAL1

HAL2

Function prototype

HAL_DCACHE_CleanInvalidByAddr_IT(DCACHE_HandleTypeDef *hdcache,
                                 const uint32_t *const pAddr,
                                 uint32_t dSize)
HAL_DCACHE_CleanInvalidByAddr_IT(hal_dcache_handle_t *hdcache,
                                 uint32_t addr,
                                 uint32_t size_byte)

Example usage

DCACHE_HandleTypeDef hdcache1;
uint32_t *address_ptr = (uint32_t *)0x20001000;
uint32_t size = 128;

HAL_DCACHE_CleanInvalidByAddr_IT(&hdcache1, address_ptr, size);
hal_dcache_handle_t hdcache1;
uint32_t address = 0x20001000;
uint32_t size = 128;

HAL_DCACHE_CleanInvalidByAddr_IT(&hdcache1, address, size);

Related concept: Other HAL DCACHE changes


HAL DCACHE get read hit value

HAL1

HAL2

HAL_DCACHE_Monitor_GetReadHitValue(const DCACHE_HandleTypeDef *hdcache)
HAL_DCACHE_GetMonitorReadHitValue(const hal_dcache_handle_t *hdcache)

HAL DCACHE monitor get read miss value

HAL1

HAL2

HAL_DCACHE_Monitor_GetReadMissValue(const DCACHE_HandleTypeDef *hdcache)
HAL_DCACHE_GetMonitorReadMissValue(const hal_dcache_handle_t *hdcache)

HAL DCACHE monitor get write hit value

HAL1

HAL2

HAL_DCACHE_Monitor_GetWriteHitValue(const DCACHE_HandleTypeDef *hdcache)
HAL_DCACHE_GetMonitorWriteHitValue(const hal_dcache_handle_t *hdcache)

HAL DCACHE monitor get write miss value

HAL1

HAL2

HAL_DCACHE_Monitor_GetWriteMissValue(const DCACHE_HandleTypeDef *hdcache)
HAL_DCACHE_GetMonitorWriteMissValue(const hal_dcache_handle_t *hdcache)

HAL DCACHE monitor reset

HAL1

HAL2

HAL_DCACHE_Monitor_Reset(DCACHE_HandleTypeDef *hdcache,
                         uint32_t MonitorType)
HAL_DCACHE_ResetMonitors(hal_dcache_handle_t *hdcache,
                         uint32_t monitor_type)

HAL DCACHE monitor start

HAL1

HAL2

HAL_DCACHE_Monitor_Start(DCACHE_HandleTypeDef *hdcache,
                         uint32_t MonitorType)
HAL_DCACHE_EnableMonitors(hal_dcache_handle_t *hdcache,
                          uint32_t monitor_type)

HAL DCACHE monitor stop

HAL1

HAL2

HAL_DCACHE_Monitor_Stop(DCACHE_HandleTypeDef *hdcache,
                        uint32_t MonitorType)
HAL_DCACHE_DisableMonitors(hal_dcache_handle_t *hdcache,
                           uint32_t monitor_type)